<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-form ref="form" :model="produces_steps" :rules="rules" label-width="100px" id="mvcfm">
      <el-button @click="gotoPage('/mes/produce/flow/FlowDetailed?'+vueparams+'')" type='primary' size="mini"><i class='fa fa-reply'></i>返回</el-button>
      <div class="form-unit">
        <span class="mvc-title-left"> 生产明细 </span>
      </div>
      <el-table :data="produces_steps">
        <el-table-column label="操作" align="center" width='100' type=''>
          <template slot-scope="scope">
            <el-dropdown trigger="click">
              <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item>
                  <el-link @click="gotoPage('206BC4CB0C2E4CE9B0E0D97578294074?'+vueparams+'')">上移</el-link>
                </el-dropdown-item>
                <el-dropdown-item>
                  <el-link @click="gotoPage('206BC4CB0C2E4CE9B0E0D97578294074?'+vueparams+'')">下移</el-link>
                </el-dropdown-item>
                <el-dropdown-item>
                  <el-link @click="gotoPage('206BC4CB0C2E4CE9B0E0D97578294074?'+vueparams+'')">添加上一步</el-link>
                </el-dropdown-item>
                <el-dropdown-item>
                  <el-link @click="gotoPage('/mes/produce/flow/NextAdd?'+vueparams+'')">添加下一步</el-link>
                </el-dropdown-item>
                <el-dropdown-item>
                  <el-link @click="gotoPage('/mes/produce/flow/AdjustJump?'+vueparams+'')">调整跳转</el-link>
                </el-dropdown-item>
                <el-dropdown-item>
                  <el-link @click="gotoPage('/mes/produce/flow/StepMove?'+vueparams+'')">移动</el-link>
                </el-dropdown-item>
                <el-dropdown-item>
                  <el-link @click="gotoPage('/mes/produce/flow/AdjustSlot?'+vueparams+'')">调整时长</el-link>
                </el-dropdown-item>
                <el-dropdown-item>
                  <el-link @click="gotoPage('/mes/produce/flow/AdjustTeam?'+vueparams+'')">调整班组</el-link>
                </el-dropdown-item>
                <el-dropdown-item>
                  <el-link @click="gotoPage(''+vueparams+'')">调整设备</el-link>
                </el-dropdown-item>
                <el-dropdown-item>
                  <el-link @click="gotoPage(''+vueparams+'')">调整工序</el-link>
                </el-dropdown-item>
                <el-dropdown-item>
                  <el-link @click="gotoPage(''+vueparams+'')">自制件外协</el-link>
                </el-dropdown-item>
                <el-dropdown-item>
                </el-dropdown-item>
                <el-dropdown-item>
                  <el-link @click="gotoPage('206BC4CB0C2E4CE9B0E0D97578294074?'+vueparams+'')">删除该步</el-link>
                </el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </template>
        </el-table-column>
        <el-table-column label="步骤" prop="workName">
        </el-table-column>
        <el-table-column label="采购" prop="workName">
        </el-table-column>
        <el-table-column label="工位" prop="position_id">
          <template slot-scope="scope">
            <el-link @click="gotoPage('/mes/produce/StationDet?CMID2='+scope.row.position_id+''+vueparams+'')" type='primary'>{{scope.row.name}}</el-link>
          </template>
        </el-table-column>
        <el-table-column label="完成日期" prop="product_end_date">
        </el-table-column>
        <el-table-column label="工作组" prop="assigned_id">
        </el-table-column>
        <el-table-column label="工作能力(S)" prop="abrasives_able">
        </el-table-column>
        <el-table-column label="需要数量" prop="sum_no">
        </el-table-column>
        <el-table-column label="步骤消耗时间" prop="expend_all_time">
        </el-table-column>
        <el-table-column label="开始工时" prop="start_inttime">
        </el-table-column>
        <el-table-column label="结束工时" prop="end_inttime">
        </el-table-column>
        <el-table-column label="开始时间点" prop="start_time">
        </el-table-column>
        <el-table-column label="结束时间点" prop="end_time">
        </el-table-column>
      </el-table>
      <div class="form-unit">
        <span class="mvc-title-left"> 采购明细 </span>
      </div>
      <el-table :data="procurement_steps">
        <el-table-column label="步骤" prop="description">
        </el-table-column>
        <el-table-column label="需要数量" prop="sum_no">
        </el-table-column>
        <el-table-column label="步骤消耗时间" prop="expend_all_time">
        </el-table-column>
        <el-table-column label="开始工时" prop="strat_inttime">
          <template slot-scope="scope">
            {{getDateTimeString(scope.row,'strat_inttime')}}
          </template>
        </el-table-column>
        <el-table-column label="结束工时" prop="end_inttime">
        </el-table-column>
        <el-table-column label="开始时间点" prop="start_time">
        </el-table-column>
        <el-table-column label="结束时间点" prop="end_time">
        </el-table-column>
      </el-table>
    </el-form>
  </div>
</template>
<script>
  import request from '@/utils/request'
  export default {
    name: 'Fit',
    components: {},
    props: ['popparams'],
    data() {
      return {
        vueparams: this.getVUEParams(""),
        produces_steps: [],
        procurement_steps: [],
        loading: false,
        rules: {}
      }
    },
    created() {
      this.getData();
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/mes/produce/flow/ProducePlan/fit?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      fitSubmit(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/mes/produce/flow/ProducePlan/fitSubmit?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
    },
  }
</script>
